package com.test2015.ui.zorder;

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.test2015.ui.shape.DrawShape;

public class ZOrderTest extends JFrame{
	public ZOrderTest(){
		JPanel main = new JPanel();
		main.setPreferredSize(new Dimension(400,300));
		main.setLayout(null);
		
		JButton btn1 = new JButton("AAAAA");
		JButton btn2 = new JButton("BBBBB");
		btn1.setBounds(10, 10, 100, 50);
		btn2.setBounds(10, 30, 100, 50);
		
		main.add(btn1);
		main.add(btn2);

//		main.setComponentZOrder(btn1, 1);
//		main.setComponentZOrder(btn2, 0);
		
		main.setComponentZOrder(btn1, 0);
		main.setComponentZOrder(btn2, 1);
		
		this.getContentPane().add(main);
		main.add(new DrawShape());
		this.pack();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null);
		this.setVisible(true);

	}
	
	public static void main(String[] args) {
		new ZOrderTest();
	}
}
